package com.shujia.batch

import java.io.InputStream
import scala.io.Source

object ZqzfIndexUtils {

  def getIndexs: Map[String, List[String]] = {
    //读取文件
    val inputStream: InputStream = this
      .getClass //获取类对象
      .getClassLoader //获取类加载器
      .getResourceAsStream("zqzf_indexs.txt")


    //转换成集合
    val linesList: List[String] = Source
      .fromInputStream(inputStream)
      .getLines()
      .toList

    //整理数据
    val kvList: List[(String, List[String])] = linesList.map(line => {
      val split: Array[String] = line.split("-")
      //指标名称
      val indexName: String = split(0)
      //统计口径
      val koujin: List[String] = split(1).split(",").toList
      (indexName, koujin)
    })

    //返回map集合
    kvList.toMap
  }

}
